<!DOCTYPE html>
<!--[if IE 7]>    <html class="no-js ie7 ie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 ie" lang="en"> <![endif]-->
<!--[if IE 9]>    <html class="no-js ie9 ie" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
	<head>
		<meta charset="utf-8" />
		<title>扩展学习_${webName}</title>
		<meta name="description" content="" />
		<meta name="author" content="HuangBQ | ${wwwRoot}" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<#include "../inc/head-common.ftl">
	</head>
	<body>
		<#include "../inc/header.ftl">
		
		<!-- Main content -->
		<div class="container" role="main">
		
			<!-- Breadcrumbs -->
			<ul class="breadcrumb">
				<li><a href="${wwwRoot}"><span class="icon-home"></span> ${wwwName}</a></li>
				<li><a href="${webRoot}">${webName}</a></li>
				<li><a href="${webRoot}ext.do">扩展学习</a></li>
				<li class="active">${ext.title}</li>
			</ul>
			<!-- Breadcrumbs -->
			
			<!-- Main data container -->
			<div class="content">
			
				<!-- Page header -->
				<div class="page-header">
					<h1><span class="icon-plus"></span> 扩展学习  <small>技术文章精选、IT职场、互联网新事...每日关注，拓展视野</small></h1>
					<ul class="page-header-actions">
						<li><a href="#typography" class="btn pull-right btn-wuxia" title="分享到朋友圈" target="_blank"><span class="icon-share"></span> 分享给朋友</a></li>
					</ul>
				</div>
				<!-- /Page header -->
				
				<!-- Page container -->
				<div class="page-container">
				
					<!-- Grid row -->
					<div class="row">
					
						<article class="span8">
							<h3>${ext.title}</h3>
							<p><span class="fam-user"></span><a href="#" title="发布人">${ext.author}</a> <i>发于${ext.createtime}</i>       &nbsp;&nbsp;&nbsp;&nbsp; 来源：${ext.source}      &nbsp;&nbsp;&nbsp;&nbsp;标签：<a href="#" title="标签">${ext.tags}</a>
							<#if ext.uid==Session["dw_uid"]>
								&nbsp;&nbsp;&nbsp;&nbsp;<a href="${webRoot}ext/edit.do?eid=${ext.eid}" title="编辑"><span class="icon-edit"></span>编辑</a>					
							</#if>
							<p>${ext.content}</p>
							<p>&nbsp;</p>
							<p><span style="cursor:pointer;"  id="support_small" class="icon-thumbs-up"></span> 喜欢（<span>${ext.supportnum}</span>） &nbsp;&nbsp;&nbsp;&nbsp; <span style="cursor:pointer;"  id="against_small" class="icon-thumbs-down"></span> 不是太喜欢 （<span>${ext.tramplenum}</span>）</p>
							<p>&nbsp;</p>							
						</article>
						
						<article class="span4">
							<div class="well">
								<a href="javascript:void(0);" id="support_big" class="btn btn-wuxia btn-success"><span class="fam-thumb-up"></span> 此文我喜欢</a>
								<a href="javascript:void(0);" id="against_big" class="btn btn-wuxia btn-danger"><span class="fam-thumb-down"></span> 不是太喜欢</a>
							</ul>
							</div>
						</article>
						
						<article class="span4">
							<h3>猜你喜欢</h3>
							<div class="well">
							<ul class="unstyled" id="related">
							</ul>
							</div>
						</article>
					</div>
					<!-- /Grid row -->
					
				</div>
				<!-- /Page container -->
				
			</div>
			<!-- /Main data container -->
			
		</div>
		<!-- /Main content -->
		
		<#include "../inc/footer.ftl">
		<script src="${scriptRoot}jquery-1.9.1.min.js" type="text/javascript"></script>
		<script>
		$(document).ready(function() {
				/*扩展图片路径替换*/
		        $(".span8").find("img").each(function(){
		            var src = $(this).attr("src");
		            if(src.indexOf("data:image")<0){//如果是流数据不转换
		            	var index = src.indexOf("http://");
		            	if(index<0){//如果是相对路径，加上根目录
					  		src = "${uploadRoot}" + src;
							$(this).attr("src", src);
		            	}
		            } 
				});
				/*赞*/
				$('#support_big').click(function(){
			            comment(1);
			            $(this).pops({title:'', text:'感谢投票！',top:35, left:0, showClose : false,timeout:400});
			        });
				/*踩*/
				$('#support_small').click(function(){
					 var praise=$(this).attr("class");
			   		 var index = praise.indexOf("fam");
			   		 if(index<0){
			   		 	var arr = praise.split("-");
			      		$(this).attr("class","fam-thumb-"+arr[2]);
			      		var supportnum = parseInt($(this).next().html());
			         	$(this).next().html(supportnum+1);
			         	comment(1);
			         	$(this).pops({title:'', text:'感谢投票！',top:25, left:0, showClose : false,timeout:400});
			   		 }
				});
				/*赞*/
				$('#against_big').click(function(){
			            comment(0);
			            $(this).pops({title:'', text:'感谢投票！',top:35, left:0, showClose : false,timeout:400});
			        });
				/*踩*/
				$('#against_small').click(function(){
						var praise=$(this).attr("class");
			   		 	var index = praise.indexOf("fam");
			   		 	if(index<0){
			   		 		var arr = praise.split("-");
			      			$(this).attr("class","fam-thumb-"+arr[2]);
				      		var supportnum = parseInt($(this).next().html());
				         	$(this).next().html(supportnum+1);
				         	comment(0);
				         	$(this).pops({title:'', text:'感谢投票！',top:25, left:0, showClose : false,timeout:400});
			   		 	}
				});
				relate();
			});
		/*异步获取文章列表*/
		function relate(){
				      var ajax_url = '${webRoot}ext/relatedList.do';/*表单地址*/
				      var ajax_type = 'POST';/*表单提交类型*/
				      var tags="${ext.tags}";
				      jQuery.ajax( {  
				           type : ajax_type,  
				           url : ajax_url,  
				           data : {tags:tags,uid:${ext.uid}},  
				           dataType : 'json',  
				           success : function(data) { 
				                var $ul = $('#related');
				                $ul.empty();
				           	   	$.each(data,function(index, item) {
				           	   	    var $li=$('<li><a href="${webRoot}ext/'+item.eid+'.do" target="_blank"><span class="icon-ok"></span>'+item.title+'</a></li>');
				           	   	    $ul.append($li);
				           	   	})
				           },  
				           error : function(data) {  
				             //alert("error:" + data)  
				           }  
				      });
		}
		/*异步提交*/
		function comment(st){
				      var ajax_url = '${webRoot}ext/vote.do';/*表单地址*/
				      var ajax_type = 'POST';/*表单提交类型*/
				      jQuery.ajax( {  
				           type : ajax_type,  
				           url : ajax_url,  
				           data : {st:st,eid:${ext.eid}},  
				           dataType : 'json',  
				           success : function(data) { 
				           	if(data.flag == '1') {

				           	} else {

				           	}		       
				           },  
				           error : function(data) {  
				             //alert("error:" + data)  
				           }  
				      });
		}
		</script>
		<script src="${scriptRoot}pops.js" type="text/javascript"></script>
</body>
</html>
